package com.lemon.service;

import java.util.Date;
import java.util.List;

import com.lemon.dao.EmployeeDao;
import com.lemon.domain.Employee;

public class EmployeeService {

	private EmployeeDao dao = new EmployeeDao();

	public Employee get(Long ie) {
		return dao.get(ie);
	}
	
	public List<Employee> findEmployeesByDepartmentId(Long departmentId) {
		return dao.findEmployeesByDepartmentId(departmentId);
	}
	
	public List<Employee> findByRoleId(Long roleId) {
		return dao.findByRoleId(roleId);
	}
	
	public List<Employee> list() {
		return dao.list();
	}
	
	public Employee login(String username, String password) {
		return dao.login(username, password);
	}
	
	public Long save(Employee e) {
		e.setCreateTime(new Date());
		return dao.save(e);
	}
	
	public int delete(Long ie) {
		return dao.delete(ie);
	}
	
	public int update(Employee e) {
		e.setUpdateTime(new Date());
		return dao.update(e);
	}
	
	public int addRole(Employee e) {
		return dao.addRole(e);
	}
}
